﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using PointOfSale.Global ;
using System.Data ;

namespace PointOfSale.Report.BCNhapXuat
{
	/// <summary>
	/// Summary description for frmPOSList.
	/// </summary>
	public class frmXuatNoiBo : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Button btnReport;
		private System.Windows.Forms.Button btnClose;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.PictureBox pictureBox1;
		private System.Windows.Forms.DateTimePicker cboFromDate;
		private System.Windows.Forms.DateTimePicker cboToDate;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public frmXuatNoiBo()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmXuatNoiBo));
			this.btnReport = new System.Windows.Forms.Button();
			this.btnClose = new System.Windows.Forms.Button();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.cboToDate = new System.Windows.Forms.DateTimePicker();
			this.cboFromDate = new System.Windows.Forms.DateTimePicker();
			this.label1 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.pictureBox1 = new System.Windows.Forms.PictureBox();
			this.groupBox1.SuspendLayout();
			this.SuspendLayout();
			// 
			// btnReport
			// 
			this.btnReport.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.btnReport.Location = new System.Drawing.Point(184, 128);
			this.btnReport.Name = "btnReport";
			this.btnReport.TabIndex = 26;
			this.btnReport.Text = "Báo cáo";
			this.btnReport.Click += new System.EventHandler(this.btnReport_Click);
			// 
			// btnClose
			// 
			this.btnClose.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.btnClose.Location = new System.Drawing.Point(264, 128);
			this.btnClose.Name = "btnClose";
			this.btnClose.TabIndex = 27;
			this.btnClose.Text = "Close";
			this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.cboToDate);
			this.groupBox1.Controls.Add(this.cboFromDate);
			this.groupBox1.Controls.Add(this.label1);
			this.groupBox1.Controls.Add(this.label2);
			this.groupBox1.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.groupBox1.Location = new System.Drawing.Point(112, 8);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(232, 112);
			this.groupBox1.TabIndex = 25;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "Select Date";
			// 
			// cboToDate
			// 
			this.cboToDate.CustomFormat = "dd/MM/yyyy HH:mm";
			this.cboToDate.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
			this.cboToDate.Location = new System.Drawing.Point(80, 72);
			this.cboToDate.Name = "cboToDate";
			this.cboToDate.Size = new System.Drawing.Size(128, 20);
			this.cboToDate.TabIndex = 10;
			this.cboToDate.Value = new System.DateTime(2005, 3, 4, 0, 0, 0, 0);
			// 
			// cboFromDate
			// 
			this.cboFromDate.CustomFormat = "dd/MM/yyyy HH:mm";
			this.cboFromDate.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
			this.cboFromDate.Location = new System.Drawing.Point(80, 40);
			this.cboFromDate.Name = "cboFromDate";
			this.cboFromDate.Size = new System.Drawing.Size(128, 20);
			this.cboFromDate.TabIndex = 9;
			this.cboFromDate.Value = new System.DateTime(2005, 3, 4, 0, 0, 0, 0);
			this.cboFromDate.ValueChanged += new System.EventHandler(this.cboFromDate_ValueChanged);
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(8, 48);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(64, 16);
			this.label1.TabIndex = 6;
			this.label1.Text = "Từ ngày";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(8, 72);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(64, 16);
			this.label2.TabIndex = 3;
			this.label2.Text = "Đến ngày";
			// 
			// pictureBox1
			// 
			this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
			this.pictureBox1.Location = new System.Drawing.Point(8, 16);
			this.pictureBox1.Name = "pictureBox1";
			this.pictureBox1.Size = new System.Drawing.Size(104, 96);
			this.pictureBox1.TabIndex = 28;
			this.pictureBox1.TabStop = false;
			// 
			// frmHDBan
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(352, 158);
			this.Controls.Add(this.btnReport);
			this.Controls.Add(this.btnClose);
			this.Controls.Add(this.groupBox1);
			this.Controls.Add(this.pictureBox1);
			this.Name = "frmXuatNoiBo";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "Bao cao xuất nội bộ";
			this.Load += new System.EventHandler(this.frmXuatNoiBo_Load_1);
			this.groupBox1.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		

			
		private void btnClose_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}

		private void btnReport_Click(object sender, System.EventArgs e)
		{
			if(cboFromDate.Value > cboToDate.Value)
			{
				MessageBox.Show(" FromDate is greater than ToDate !","Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
			}
			else
			{
				frmReportXuatNoiBo frm = new frmReportXuatNoiBo();
				frm.FromDate = cboFromDate.Value;
				frm.ToDate = cboToDate.Value;
				frm.strDepartment = "ALL";
				frm.ShowDialog();
			}		
		}

		private void cboFromDate_ValueChanged(object sender, System.EventArgs e)
		{
		
		}

		private void frmXuatNoiBo_Load_1(object sender, System.EventArgs e)
		{
			// Add CategoryName to cboCategory
			cboFromDate.Value=System.DateTime.Now.AddDays(-10).Date;
			cboToDate.Value= System.DateTime.Now.Date.AddHours(23);
		}
	}
}
